from sklearn.ensemble import RandomForestClassifier  # 随机森林
from sklearn.model_selection import train_test_split   # 数据集划分
from sklearn.datasets import make_classification   # 生成分类数据

X, y  = make_classification(n_samples=100, n_features=20, random_state=42)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3)
 
 
rf = RandomForestClassifier(n_estimators=100, random_state=42) 
rf.fit(X_train, y_train) 

predictions = rf.predict(X_test)

print("Predictions:", predictions)